package com.artPreter.mapper;

import com.artPreter.pojo.ArtType;
import com.artPreter.pojo.Artwork;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 艺术品表 Mapper 接口
 * </p>
 *
 * @author jarvis
 * @since 2024-11-14
 */
@Mapper
public interface ArtworkMapper extends BaseMapper<Artwork> {

    @Select(" select b.*  FROM jv_content_artwork_relative s left join jv_artwork b on s.artwork_id = b.artwork_id ${ew.customSqlSegment} ")
    List<Artwork> getRelatedArtworkList(@Param(Constants.WRAPPER) Wrapper wrapper);

    @Select(" select b.*  FROM jv_content_artwork_relative s left join jv_artwork b on s.artwork_id = b.artwork_id ${ew.customSqlSegment} ")
    List<Artwork> getArtistRelatedArtworkList(@Param(Constants.WRAPPER) Wrapper wrapper);
    @Select(" select s.* from jv_artwork s left join jv_artwork_depart_relative b on s.artwork_id = b.artwork_id  ${ew.customSqlSegment}  ")
    IPage<Artwork> getDepartRelatedArtworkPageList(IPage<Artwork> artworkIPage, @Param(Constants.WRAPPER) Wrapper wrapper);

    @Select(" select b.*  FROM jv_content_artwork_relative s left join jv_artwork b on s.artwork_id = b.artwork_id ${ew.customSqlSegment}  ")
    IPage<Artwork> getRelatedArtworkPageList(IPage<Artwork> artworkIPage, @Param(Constants.WRAPPER) Wrapper wrapper);

    @Select(" select b.artwokt_type as typeId  FROM jv_content_artwork_relative s left join jv_artwork b on s.artwork_id = b.artwork_id ${ew.customSqlSegment}  group by b.artwokt_type ")
    List<ArtType> getArtistRelatedArtworkArtTypegetPageList(@Param(Constants.WRAPPER) Wrapper wrapper);

    @Select(" select b.*  FROM jv_content_artwork_relative s left join jv_artwork b on s.artwork_id = b.artwork_id ${ew.customSqlSegment} ")
    IPage<Artwork> getEventExhibitionRelatedArtworkPageList(IPage<Artwork> artworkIPage, @Param(Constants.WRAPPER) Wrapper wrapper);

    @Select( " select b.artwokt_type  FROM jv_content_artwork_relative s left join jv_artwork b on s.artwork_id = b.artwork_id ${ew.customSqlSegment} group by b.artwokt_type")
    List<Artwork> getRelatedArtworkArtTypegetList(@Param(Constants.WRAPPER) Wrapper wrapper);

    @Select(" select artwokt_type from jv_artwork  ${ew.customSqlSegment} group by artwokt_type ")
    List<Artwork> getDepartRelatedArtworkTypegetList(@Param(Constants.WRAPPER) Wrapper wrapper);
}
